<!DOCTYPE html><html><head><title>Ext.Version | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
<style type="text/css">.head-band { display: none; }
.header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
.doc-tab .members .member a.more { background-color: #efefef; }
</style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
</head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
<a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">

    req = {
        liveURL: '.',
        standAloneMode: true,
        origDocClass: 'Ext.Version',
        docClass: 'Ext.Version',
        docReq: 'Ext.Version',
        version: '4.0',
        baseURL: '.',
        baseDocURL: '.',
        baseProdURL: '.'
    };

    clsInfo = {};



</script>

<script type="text/javascript" src="../search.js"></script>
<!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
<script type="text/javascript" src="../class_tree.js"></script>
<script type="text/javascript" src="../class_doc.js"></script>
<script type="text/javascript">
    req.source = 'Version.html#Ext-Version';
    clsInfo = {"methods":["Version","compare","deprecate","equals","getBuild","getComponentValue","getMajor","getMinor","getPatch","getRelease","getShortVersion","getVersion","isGreaterThan","isLessThan","match","setVersion","toArray"],"cfgs":[],"properties":[],"events":[],"subclasses":[]};
    Ext.onReady(function() {
        Ext.create('Docs.classPanel');
    });
</script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Version.html#Ext-Version" target="_blank">Ext.Version</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>A utility class that wrap around a string version number and provide convenient
method to perform comparison. See also: <a href="Ext.Version.html#compare" rel="Ext.Version#compare" class="docClass">compare</a>. Example:</p>

<pre class="prettyprint"><code>var version = new Ext.Version('1.0.2beta');
console.log("Version is " + version); // Version is 1.0.2beta

console.log(version.getMajor()); // 1
console.log(version.getMinor()); // 0
console.log(version.getPatch()); // 2
console.log(version.getBuild()); // 0
console.log(version.getRelease()); // beta

console.log(version.isGreaterThan('1.0.1')); // True
console.log(version.isGreaterThan('1.0.2alpha')); // True
console.log(version.isGreaterThan('1.0.2RC')); // False
console.log(version.isGreaterThan('1.0.2')); // False
console.log(version.isLessThan('1.0.2')); // True

console.log(version.match(1.0)); // True
console.log(version.match('1.0.2')); // True
</code></pre>
<div class="members"><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-Version" class="member f ni"><a href="Ext.Version.html#method-Version" rel="method-Version" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-constructor" class="viewSource">view source</a></div><a name="Version"></a><a name="method-Version"></a><a href="Ext.Version.html#" rel="method-Version" class="cls expand">Version</a>(
<span class="pre">String/Number version, Object version</span>)
 : Ext.Version</div><div class="description"><div class="short"><p>&nbsp;</p></div><div class="long">
<h3 class="pa">Parameters</h3><ul><li><span class="pre">version</span> : String/Number<div class="sub-desc"><p>The version number in the follow standard format: major[.minor[.patch[.build[release]]]]
Examples: 1.0 or 1.2.3beta or 1.2.3.4RC</p>
</div></li><li><span class="pre">version</span> : Object<div class="sub-desc">
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Ext.Version</span>&nbsp; &nbsp;<p>this</p>
</li></ul></div></div></div><div id="method-compare" class="member ni"><a href="Ext.Version.html#method-compare" rel="method-compare" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-compare" class="viewSource">view source</a></div><a name="compare"></a><a name="method-compare"></a><a href="Ext.Version.html#" rel="method-compare" class="cls expand">compare</a>(
<span class="pre">String current, String target</span>)
 : Number</div><div class="description"><div class="short">Compare 2 specified versions, starting from left to right. If a part contains special version strings,
they are handl...</div><div class="long"><p>Compare 2 specified versions, starting from left to right. If a part contains special version strings,
they are handled in the following order:
'dev' &lt; 'alpha' = 'a' &lt; 'beta' = 'b' &lt; 'RC' = 'rc' &lt; '#' &lt; 'pl' = 'p' &lt; 'anything else'</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">current</span> : String<div class="sub-desc"><p>The current version to compare to</p>
</div></li><li><span class="pre">target</span> : String<div class="sub-desc"><p>The target version to compare to</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>Returns -1 if the current version is smaller than the target version, 1 if greater, and 0 if they're equivalent</p>
</li></ul></div></div></div><div id="method-deprecate" class="member ni"><a href="Ext.Version.html#method-deprecate" rel="method-deprecate" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-deprecate" class="viewSource">view source</a></div><a name="deprecate"></a><a name="method-deprecate"></a><a href="Ext.Version.html#" rel="method-deprecate" class="cls expand">deprecate</a>(
<span class="pre">String packageName, String since, Function closure, Object scope</span>)
 : void</div><div class="description"><div class="short">Create a closure for deprecated code.

// This means Ext.oldMethod is only supported in 4.0.0beta and older.
// If Ex...</div><div class="long"><p>Create a closure for deprecated code.</p>

<pre><code>// This means Ext.oldMethod is only supported in 4.0.0beta and older.
// If Ext.getVersion('extjs') returns a version that is later than '4.0.0beta', for example '4.0.0RC',
// the closure will not be invoked
Ext.deprecate('extjs', '4.0.0beta', function() {
    Ext.oldMethod = Ext.newMethod;

    ...
});
</code></pre>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">packageName</span> : String<div class="sub-desc"><p>The package name</p>
</div></li><li><span class="pre">since</span> : String<div class="sub-desc"><p>The last version before it's deprecated</p>
</div></li><li><span class="pre">closure</span> : Function<div class="sub-desc"><p>The callback function to be executed with the specified version is less than the current version</p>
</div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>The execution scope (<tt>this</tt>) if the closure</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-equals" class="member ni"><a href="Ext.Version.html#method-equals" rel="method-equals" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-equals" class="viewSource">view source</a></div><a name="equals"></a><a name="method-equals"></a><a href="Ext.Version.html#" rel="method-equals" class="cls expand">equals</a>(
<span class="pre">String/Number target</span>)
 : Boolean</div><div class="description"><div class="short"><p>Returns whether this version equals to the supplied argument</p>
</div><div class="long"><p>Returns whether this version equals to the supplied argument</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">target</span> : String/Number<div class="sub-desc"><p>The version to compare with</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if this version equals to the target, false otherwise</p>
</li></ul></div></div></div><div id="method-getBuild" class="member ni"><a href="Ext.Version.html#method-getBuild" rel="method-getBuild" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getBuild" class="viewSource">view source</a></div><a name="getBuild"></a><a name="method-getBuild"></a><a href="Ext.Version.html#" rel="method-getBuild" class="cls expand">getBuild</a> : Number</div><div class="description"><div class="short"><p>Returns the build component value</p>
</div><div class="long"><p>Returns the build component value</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>build</p>
</li></ul></div></div></div><div id="method-getComponentValue" class="member ni"><a href="Ext.Version.html#method-getComponentValue" rel="method-getComponentValue" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getComponentValue" class="viewSource">view source</a></div><a name="getComponentValue"></a><a name="method-getComponentValue"></a><a href="Ext.Version.html#" rel="method-getComponentValue" class="cls expand">getComponentValue</a>(
<span class="pre">Mixed value</span>)
 : Mixed</div><div class="description"><div class="short"><p>Converts a version component to a comparable value</p>
</div><div class="long"><p>Converts a version component to a comparable value</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : Mixed<div class="sub-desc"><p>The value to convert</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Mixed</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-getMajor" class="member ni"><a href="Ext.Version.html#method-getMajor" rel="method-getMajor" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getMajor" class="viewSource">view source</a></div><a name="getMajor"></a><a name="method-getMajor"></a><a href="Ext.Version.html#" rel="method-getMajor" class="cls expand">getMajor</a> : Number</div><div class="description"><div class="short"><p>Returns the major component value</p>
</div><div class="long"><p>Returns the major component value</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>major</p>
</li></ul></div></div></div><div id="method-getMinor" class="member ni"><a href="Ext.Version.html#method-getMinor" rel="method-getMinor" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getMinor" class="viewSource">view source</a></div><a name="getMinor"></a><a name="method-getMinor"></a><a href="Ext.Version.html#" rel="method-getMinor" class="cls expand">getMinor</a> : Number</div><div class="description"><div class="short"><p>Returns the minor component value</p>
</div><div class="long"><p>Returns the minor component value</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>minor</p>
</li></ul></div></div></div><div id="method-getPatch" class="member ni"><a href="Ext.Version.html#method-getPatch" rel="method-getPatch" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getPatch" class="viewSource">view source</a></div><a name="getPatch"></a><a name="method-getPatch"></a><a href="Ext.Version.html#" rel="method-getPatch" class="cls expand">getPatch</a> : Number</div><div class="description"><div class="short"><p>Returns the patch component value</p>
</div><div class="long"><p>Returns the patch component value</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>patch</p>
</li></ul></div></div></div><div id="method-getRelease" class="member ni"><a href="Ext.Version.html#method-getRelease" rel="method-getRelease" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getRelease" class="viewSource">view source</a></div><a name="getRelease"></a><a name="method-getRelease"></a><a href="Ext.Version.html#" rel="method-getRelease" class="cls expand">getRelease</a> : Number</div><div class="description"><div class="short"><p>Returns the release component value</p>
</div><div class="long"><p>Returns the release component value</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>release</p>
</li></ul></div></div></div><div id="method-getShortVersion" class="member ni"><a href="Ext.Version.html#method-getShortVersion" rel="method-getShortVersion" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getShortVersion" class="viewSource">view source</a></div><a name="getShortVersion"></a><a name="method-getShortVersion"></a><a href="Ext.Version.html#" rel="method-getShortVersion" class="cls expand">getShortVersion</a> : String</div><div class="description"><div class="short"><p>Returns shortVersion version without dots and release</p>
</div><div class="long"><p>Returns shortVersion version without dots and release</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-getVersion" class="member ni"><a href="Ext.Version.html#method-getVersion" rel="method-getVersion" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getVersion" class="viewSource">view source</a></div><a name="getVersion"></a><a name="method-getVersion"></a><a href="Ext.Version.html#" rel="method-getVersion" class="cls expand">getVersion</a>(
<span class="pre">String packageName</span>)
 : Ext.Version</div><div class="description"><div class="short">Get the version number of the supplied package name; will return the last registered version
(last Ext.setVersion cal...</div><div class="long"><p>Get the version number of the supplied package name; will return the last registered version
(last Ext.setVersion call) if there's no package name given.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">packageName</span> : String<div class="sub-desc"><p>(Optional) The package name, for example: 'core', 'touch', 'extjs'</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Ext.Version</span>&nbsp; &nbsp;<p>The version</p>
</li></ul></div></div></div><div id="method-isGreaterThan" class="member ni"><a href="Ext.Version.html#method-isGreaterThan" rel="method-isGreaterThan" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-isGreaterThan" class="viewSource">view source</a></div><a name="isGreaterThan"></a><a name="method-isGreaterThan"></a><a href="Ext.Version.html#" rel="method-isGreaterThan" class="cls expand">isGreaterThan</a>(
<span class="pre">String/Number target</span>)
 : Boolean</div><div class="description"><div class="short"><p>Returns whether this version if greater than the supplied argument</p>
</div><div class="long"><p>Returns whether this version if greater than the supplied argument</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">target</span> : String/Number<div class="sub-desc"><p>The version to compare with</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if this version if greater than the target, false otherwise</p>
</li></ul></div></div></div><div id="method-isLessThan" class="member ni"><a href="Ext.Version.html#method-isLessThan" rel="method-isLessThan" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-isLessThan" class="viewSource">view source</a></div><a name="isLessThan"></a><a name="method-isLessThan"></a><a href="Ext.Version.html#" rel="method-isLessThan" class="cls expand">isLessThan</a>(
<span class="pre">String/Number target</span>)
 : Boolean</div><div class="description"><div class="short"><p>Returns whether this version if smaller than the supplied argument</p>
</div><div class="long"><p>Returns whether this version if smaller than the supplied argument</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">target</span> : String/Number<div class="sub-desc"><p>The version to compare with</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if this version if smaller than the target, false otherwise</p>
</li></ul></div></div></div><div id="method-match" class="member ni"><a href="Ext.Version.html#method-match" rel="method-match" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-match" class="viewSource">view source</a></div><a name="match"></a><a name="method-match"></a><a href="Ext.Version.html#" rel="method-match" class="cls expand">match</a>(
<span class="pre">String/Number target</span>)
 : Boolean</div><div class="description"><div class="short">Returns whether this version matches the supplied argument. Example:

var version = new Ext.Version('1.0.2beta');
con...</div><div class="long"><p>Returns whether this version matches the supplied argument. Example:</p>

<pre><code>var version = new Ext.Version('1.0.2beta');
console.log(version.match(1)); // True
console.log(version.match(1.0)); // True
console.log(version.match('1.0.2')); // True
console.log(version.match('1.0.2RC')); // False
</code></pre>

<h3 class="pa">Parameters</h3><ul><li><span class="pre">target</span> : String/Number<div class="sub-desc"><p>The version to compare with</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if this version matches the target, false otherwise</p>
</li></ul></div></div></div><div id="method-setVersion" class="member ni"><a href="Ext.Version.html#method-setVersion" rel="method-setVersion" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-setVersion" class="viewSource">view source</a></div><a name="setVersion"></a><a name="method-setVersion"></a><a href="Ext.Version.html#" rel="method-setVersion" class="cls expand">setVersion</a>(
<span class="pre">String packageName, String/Ext.Version version</span>)
 : Ext</div><div class="description"><div class="short"><p>Set version number for the given package name.</p>
</div><div class="long"><p>Set version number for the given package name.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">packageName</span> : String<div class="sub-desc"><p>The package name, for example: 'core', 'touch', 'extjs'</p>
</div></li><li><span class="pre">version</span> : String/Ext.Version<div class="sub-desc"><p>The version, for example: '1.2.3alpha', '2.4.0-dev'</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Ext</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-toArray" class="member ni"><a href="Ext.Version.html#method-toArray" rel="method-toArray" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-toArray" class="viewSource">view source</a></div><a name="toArray"></a><a name="method-toArray"></a><a href="Ext.Version.html#" rel="method-toArray" class="cls expand">toArray</a> : Array</div><div class="description"><div class="short"><p>Returns this format: [major, minor, patch, build, release]. Useful for comparison</p>
</div><div class="long"><p>Returns this format: [major, minor, patch, build, release]. Useful for comparison</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;
</li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>